<style type="text/css">
  /* --- 取消数字输入框后面上下箭头 --- */
  .noArrow::-webkit-outer-spin-button,
  .noArrow::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
  }
  .noArrow {
    -moz-appearance: textfield;
  }
</style>
<div class="wrapper-md ng-scope">
<div class="row" novalidate>

  <!-- 左侧树结构 -->
  <div class="col-md-4">
    <div class="panel panel-default ">
      <div class="panel-heading font-bold">机构列表</div>
      <div class="panel-body">
        <treecontrol class="tree-boot"
          tree-model="dataForTheTree"
          options="treeOptions"
          on-selection="showSelected(node)"
          selected-node="node1">
          {{node.name}}
        </treecontrol>
      </div>
    </div>
  </div>

  <!-- 右侧表结构 -->
  <div class="col-md-8">
    <div class="panel panel-default">
      <tabset class="tab-container" >

        <tab heading="用户列表" ng-click="cancel()" active="status.active">
          <div class="row wrapper" >
            <div class="col-sm-4">
              <div class="input-group" >
                <div class="input-group-btn" >
                  <span class="btn btn-default">登录名</span>
                </div>
                <input type="text" class="form-control" ng-model="search.loginname">
              </div>
            </div>
            <div class="col-sm-4">
              <div class="input-group" >
                <div class="input-group-btn" >
                  <span class="btn btn-default">手机号</span>
                </div>
                <input type="text" class="form-control" ng-model="search.mobile">
              </div>
            </div>
            <button class="btn m-b-xs w-xs btn-success" ng-click="search()">搜索</button>
          </div>

          <div class="panel-body">
            <table class="table table-bordered ng-isolate-scope dataTable no-footer" 
              style="display: table; width: 100%;table-layout:fixed;">
              <thead>
                <tr>
                  <th class="col-md-2 text-center">归属公司</th>
                  <th class="col-md-2 text-center">登录名</th>
                  <th class="col-md-2 text-center">名称</th>
                  <th class="col-md-2 text-center">手机</th>
                  <th class="col-md-2 text-center">操作</th>
                </tr>
              </thead>
              <tbody>
                <tr ng-repeat="info in user_list" ng-class="{true:'red',false:''}[{{info.color}}]" >
                  <td class="text-center">{{info.company_name}}</td>
                  <td class="text-center">{{info.login_name}}</td>
                  <td class="text-center">{{info.name}}</td>
                  <td class="text-center">{{info.mobile}}</td>
                  <td class="text-center">
                    <div ng-if="info.flag == 1">
                      <button type="button" class="btn btn-info btn-xs" ng-click="update(info)">修改</button>
                      <button type="button" class="btn btn-danger btn-xs" ng-click="delete(info)">删除</button>
                    </div>
                  </td>
                </tr>
              </tbody>
            </table>
          </div>
          <pagination total-items="totalItems" ng-model="currentPage" ng-change="search(currentPage)" previous-text="上一页"
              next-text="下一页" first-text="首页" last-text="尾页" max-size="5" boundary-links="true" rotate="false"
              items-per-page="itemsPerPage" class="m-t-none m-b"></pagination>
        </tab>
        
        <tab heading={{tabname.name}} ng-click="add()" active="tabname.active">
          <div class="panel-body">
            <form name="form1" class="form-horizontal form-validation ng-pristine ng-valid ng-valid-required">
              <div class="form-group">
                <label class="col-lg-3 control-label">归属公司:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" ng-disabled="true" ng-model="obj.company_name">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">登录手机号:</label>
                <div class="col-lg-6">
                  <input type="number" class="form-control noArrow" placeholder="必填" ng-model="obj.mobile">
                </div>
              </div>
              <div class="form-group" ng-show="!status.adduser">
                <label class="col-lg-3 control-label">登录名:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" ng-model="obj.login_name">
                </div>
              </div>
              <div class="form-group" ng-show="!status.adduser">
                <label class="col-lg-3 control-label">工号:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" ng-model="obj.no">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">姓名:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" placeholder="必填" ng-model="obj.name">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">密码:</label>
                <div class="col-lg-6">
                  <input type="password" class="form-control" maxlength="50" minlength="3" placeholder="必填" ng-pattern="/^[a-zA-Z0-9]{3,20}$/" 
                  name="password" popover="密码长度在3-20之间" popover-trigger="mouseenter" ng-model="obj.password" required="">
                </div>
                <label class="control-label text-muted" ng-show="!status.adduser">若不修改密码，请留空。</label>
                <label class="control-label" ng-show="form1.password.$dirty" style="color:red">
                  <span ng-show="form1.password.$invalid && !form1.password.$error.required" class="ng-hide">密码长度在3-20之间!</span>
                </label>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">确认密码:</label>
                <div class="col-lg-6">
                  <input type="password" class="form-control" maxlength="50" minlength="3" placeholder="必填" name="passwordc" 
                  ng-model="obj.passwordc" required="" ui-validate=" '$value==obj.password' " ui-validate-watch=" 'obj.password' ">
                </div>
                <label class="control-label" ng-show="form1.passwordc.$dirty" style="color:red">
                  <span ng-show="form1.passwordc.$error.validator && !form1.passwordc.$error.required" class="ng-hide">两次密码不相同!</span>
                </label>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">邮箱:</label>
                <div class="col-lg-6">
                  <input type="email" name="email" class="form-control" ng-model="obj.email" required="">
                </div>
                <label class="control-label" ng-show="form1.email.$dirty" style="color:red">
                  <span ng-show="form1.email.$invalid && !form1.email.$error.required" class="ng-hide">邮箱格式不正确!</span>
                </label>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">电话:</label>
                <div class="col-lg-6">
                  <input type="text" class="form-control" ng-model="obj.phone">
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">允许登录:</label>
                <div class="col-lg-6">
                  <label class="i-switch m-t-xs m-r">
                    <input type="checkbox" ng-model="obj.login_flag" ng-true-value="'1'" ng-false-value="'0'"
                      class="ng-pristine ng-untouched ng-valid ng-not-empty" ng-init="obj.login_flag='1'">
                    <i></i>
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">用户类型:</label>
                <div class="col-lg-6">
                  <select ng-model="obj.user_type" class="form-control">
                    <option value="">请选择</option>
                    <option value="1">系统管理</option>
                    <option value="2">部门经理</option>
                    <option value="3">普通用户</option>
                    <option value="9">接口对接</option>
                  </select>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">* 用户角色:</label>
                <div class="col-lg-9">
                  <label ng-repeat="info in role_list" class="btn btn-xs btn-default" 
                  style="margin-bottom:2px; margin-right:2px; width:116px" ng-model="info.active" btn-checkbox="" >
                      <span class="text">{{info.name}}</span>
                      <i class="fa fa-check text-active"></i>
                      <span class="text-active">{{info.name}}</span>    
                  </label>
                </div>
              </div>
              <div class="form-group">
                <label class="col-lg-3 control-label">备注:</label>
                <div class="col-lg-6">
                  <textarea class="form-control" rows="3" ng-model="obj.remarks"></textarea>
                </div>
              </div>
              <div class="form-group" ng-if="!status.adduser">
                <label class="col-lg-3 control-label">创建时间:</label>
                <div class="col-lg-6">
                  <label class="control-label">{{obj.create_date}}</label>
                </div>
              </div>
              <div class="form-group" ng-if="!status.adduser">
                <label class="col-lg-3 control-label">最后登录:</label>
                <div class="col-lg-6">
                  <label style="width:120px">IP: {{obj.login_ip}}</label>
                  <label style="width:165px">时间: {{obj.login_date}}</label>
                </div>
              </div>
            </form>

            <div class="col-lg-4 col-lg-offset-3">
              <button class="btn btn-primary btn-rounded" ng-if="status.adduser" ng-click="addUser()">添加</button>
              <button class="btn btn-primary btn-rounded" ng-if="!status.adduser" ng-click="save()">保存</button>
              <button class="btn btn-default btn-rounded" ng-click="cancel()">取消</button>
            </div>
          </div>
        </tab>

      </tabset>

    </div>
  </div>
</div>
</div>


